<template>
	<view>
	</view>
</template>

<script>
	import store from "@/store";
	import {
		mapGetters
	} from "vuex";
	export default {
		data() {
			return {

				Id: null,
				Detail: null,
				formData: null,
				OrganizationList: [],
			}
		},
		computed: {
			...mapGetters(["userInfo", 'userId']),
		},
		onLoad(option) {
			this.Id = option.Id;

		},
		onShow() {

			this.GetOrganizationApi();
			this.OrganizationListApi();

		},
		methods: {
			/**
			 * 班级单个查询
			 */
			async GetOrganizationApi() {
				let {
					Data
				} = await this.$http.PostAsync("/Organization/Get", {
					Id: this.Id
				});
				this.Detail = Data;

			},
			/**
			 * 班级查询
			 */
			async OrganizationListApi() {
				let {
					Data: {
						Items
					}
				} = await this.$http.PostAsync("/Organization/List", {

				});
				this.OrganizationList = Items;
			},
			/**
			 * 班级保存或者修改
			 */
			async Save() {
				let confirm = await this.$comm.ShowModal("你确定要操作吗?");

				if (confirm == false) {
					await this.$comm.ShowToast("用户放弃操作");
					return;
				}
				let {
					Data,
					Success,
				} = await this.$http.PostAsync("/Organization/CreateOrEdit", this.formData);
				if (Success) {
					await this.$comm.ShowToast("操作成功");
					await this.$comm.ReturnPage();
				}
			}


		}
	}
</script>

<style>

</style>